﻿<html>
<head>
	 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>一人一本 - 试过才知道</title>

    <!--<link href="css/bootstrap.css" rel="stylesheet">-->
	<!--<link href="css/bootstrap-responsive.min.css" rel="stylesheet">-->
	<link href="css/productlist.css" rel="stylesheet">
	<link href="css/inspiritas.css" rel="stylesheet">
	<link href="css/carousel.css" rel="stylesheet">
	<script src="js/jquery-1.7.1.min.js"></script>
	<script src="js/jquery.form.js"></script>
    <script src="js/bootstrap.min.js"></script>
	<script src="js/jquery.json-2.4.js"></script>
    <script src="js/jquery.cookie.js"></script>
	<script>
	$(document).ready(	
		function()
		{
			typeListClick();
			<?php include "htm/ready.htm";?>
			 $.getJSON('index.php?act=productdetail.show_detail_page&product_id=<?php echo $_GET['product_id']; ?>&user_name=<?php echo $_SESSION['user']['ID']; ?>',function(data){
					$('#product-title').text(data.Name);
					$('#first_author').text(data.Author);
					$('#product-raw-price-content').text(data.Price);
					$('#product-new-price-content').text(data.Current_Price);
					$('#saved-value').text(data.Saved_Value);
					$('#saved-proportion').text(data.Saved_Proportion);
					$('#product-description').text(data.description);
					$('#publisher').text(data.publisher);
					$('#totalpage').text(data.totalpage);
					$('#isbn').text(data.isbn);
					$('#language').text(data.language);	
					$('#productimage').attr("src",data.Image);
					if(data.Discount_Type==3)
					{
						html='<div class="absolute-label" style="top:250;width:100">'+
								'<img id = "" src="img/团购图标.png" >'+
							'</div>';
						$('#label').append(html);
					}
					
					if(data.quantity==0)
					{
						$('#cart_add').addClass("disabled");
					}

					var Status=data.Stock>0?'现在有货':'现在缺货';
					$('#product-status').text(Status);
					var favorites=data.favorites>0?'已收藏':'加入收藏夹';
					$('#favorites').text(favorites);
					if (favorites=="已收藏")
					{
						//$('#favorites_type').removeClass();
						$('#favorites').addClass("disabled");
					}
				}
			);
			 $.ajax({
				url:'index.php?act=productdetail.show_detail_page&product_id=<?php echo $_GET['product_id']; ?>',
				type:'POST',
				success:function(data){
					//alert(data);
				}
			});
		}
	);
	
	function set_favorites()
	{	
		$.ajax({
	   type: "POST",
	   url: 'index.php?act=favorite.add_favorite&productid=<?php echo $_GET['product_id']; ?>',
	   success: function(data){	
		   var result = $.evalJSON(data);
		   if ($('#favorites').hasClass("disabled"))
		   {
				return false;
		   }
		   else
		   {
				if(result.success==false)
				{
					alert("请登录");
				}
				if(result.success==true)
				{
					alert("收藏成功");
					$("#favorites").text('已收藏');
					//$('#favorites').removeClass();
					$('#favorites').addClass("disabled");
			   }
		   }
	   }
	   
	 });

	}

	function typeListClick()
	{
		$('#type-list').children(':not(".divider,h2")').click(function(){
			$(this).addClass('active');
			$(this).siblings().removeClass('active');
		});
	}
	</script>
</head>
<body>


<?php include "htm/head.htm";?>
<div style="margin-left:40;margin-right:40;height:400px;">
	<!--<div class="" style="width:215px;height:400px; float:right;">
		<div class="well" style="background-color:#c0dbf2;"></div>
	</div>-->
    <div style="padding-right:20px;" >
		<div class="book-item">
			<div id="label"></div>
			<a href="#"><img id = "productimage" style="height:300;width:280;float:left;" src="img/book-cover/jiayuan.jpg"></a>
			
			<div class="" style="padding-left:300px;">
				<div class="product-basic-info">
					<span id="product-title" class="product-title">书名</span>
					<div class="cover-type"><span id="cover-type"></span></div>
					<div id="product-authors">
						<span class="carat juicy">›</span>
						<span id="first_author" href="#"></span>
						
						<a href=""></a>
					<div class="">
						<!--<strong id="favorites_type" class="clickabled" onclick="set_favorites()"><a id="favorites" class="btn btn-success" href="#收藏">收藏</a></strong>-->
					<div>
					</div>
					<hr class="type-seperator">
					<table class="product-price">
						<tbody>
							<tr id="raw-price-row">
								<td  class="price-label smoke">市场价:&nbsp;</td>
								<td>￥ <span id="product-raw-price-content" class="book-price-old smoke">19.00</span></td>
							</tr>
							<tr id="actural-price-row">
								<td class="price-label smoke bold">本站价格:&nbsp;</td>
								<td>￥<span id="product-new-price-content" class="book-price-new red"></span></td>
							</tr>
							<tr class="youSavePriceRow">
								<td class="price-label smoke">为您节省:&nbsp;</td>
								<td id="product-saved-price-content" class="book-price-saved red">
									￥ 
									<span id="saved-value">4.50</span> 
									(
									<span id="saved-proportion">7.6</span>
									折)
								</td>
							</tr>
						</tbody>
					</table>
					<div id="product-status" class="halcyon">现在有货</div>
					<div>由<strong>一人一本</strong>直接销售和发货。</div>
					<div class="row-fluid" style="margin-top:20px;">
						<form class="span6" name="set_quantity" id="set_quantity" action="index.php?act=cart.cart_add" method="post" style="width:17%">
							<input type="hidden" name="product_id" value="<?php echo $_GET['product_id']; ?>">
							<select name="num" id="product_num" style="width: 50">
							<option value="1" selected="selected">1</option>
							<option value="2">2</option>
							<option value="3">3</option>
							<option value="4">4</option>
							<option value="5">5</option>					
							</select>
							<input id="cart_add" class="btn btn-primary" type="submit"  value="加入购物车" style="height:30;margin-top:-11" ></input>
						</form>
					<!--<strong id="favorites_type" class="disabled" onclick="set_favorites()"><a id="favorites" class="btn btn-success disabled"  style="margin-top:-11" href="#收藏">收藏</a></strong>-->
						<div id="favorites" onclick="set_favorites()" class="btn btn-success " style="width:10%"> 收藏</div>
					<script>
						$('#set_quantity').submit(function(){
							if(!$("#cart_add").hasClass("disabled"))
							{
							$(this).ajaxSubmit({url : "index.php?act=cart.cart_add",
								type : "post",
								dataType : 'json',
								success : function(o){
									alert(o.msg);
							}});
							}
							return false;
						});
					</script>
	<!--				<button type="add" class="btn btn-success btn-mini" >加入购物车</button>-->
					</div>
					<div class="halcyon">商品描述:</div>
					<div id="product-description">商品描述</div>
					<div></div>
					
	<!--				<div id="button-group" class="row-fluid" style="margin-top:20px;">
						<div class="span4 btn btn-large btn-primary" style="font-size:1.6em;height:50;"><div style="padding-top:5px;">加入购物车</div></div>
						<div class="span4 btn" style="font-size:1.6em;height:50;"><div style="padding-top:8px;">收藏</div></div>
					</div>-->			
				</div>
			</div>
		</div>
    </div>
 </div>
 
 <div>
	<hr class="type-seperator"> 
 </div>
 
 <div>
	<table id="addresses" cellspacing="1" cellpadding="3" class="table table-default table-bordered table-striped table-condensed">
		<tbody>
			<tr>
				<h2>基本信息</h2>
			</tr>
			<tr><td><b>出版社:</b></td> <td id="publisher">南海出版公司; 第1版 (2011年6月2日)</td></tr>
			<!--<tr><td><b>外文书名:</b></td> <td>&nbsp;<a href="#">One Hundred Years of Solitude</a></td></tr>-->
			<tr><td><b>精装:</b></td> <td id="totalpage"> 360页</td></tr>
			<tr><td><b>语种：</b></td> <td id="language"> 简体中文</td></tr>
			<!--<tr><td><b>开本:</b></td> <td> 32</td></tr>-->
			<tr><td><b>>ISBN:</b></td> <td id="isbn"> 9787544253994, 7544253996</td></tr>
			<!--<tr><td><b>>条形码:</b></td> <td> 9787544253994</td></tr>
			<tr><td><b>商品尺寸: </b></td> <td>20.8 x 14.8 x 2.8 cm</td></tr>
			<tr><td><b>商品重量: </b></td> <td>581 g</td></tr>
			<tr><td><b>品牌:</b></td> <td> 新经典文化</td></tr>
			<tr><td><b>ASIN: </b></td> <td>B0052IGZFO</td></tr>-->
		</tbody>
	</table>
 </div>

 



<?php include "htm/footer.htm";?>
<?php include "htm/copyright.htm";?>
</body>
</html>